function [x,y,Fnew, Gnew, iter] = newtonIteration2(func, x0, y0, maxiter, eps1, eps2)
%  输入：变量x、y; 函数F; 迭代初值x0,x1,y0,y1 最大迭代次数maxi 精度要求epsilon
%  返回：迭代结果，迭代次数
global d2r
iter = 0; % 记录迭代次数
i = 0;
maxi = 3;
h = 0.01;
lambda = 1;
[F0, G0] = func(x0, y0);
[F1, G1] = func(x0+h, y0);
[F2, G2] = func(x0, y0+h);
dF0 = (F1 - F0)/h;
dF1 = (F2 - F0)/h;
dG0 = (G1 - G0)/h;
dG1 = (G2 - G0)/h;
df = [dF0, dF1; dG0, dG1];
xynew = [x0; y0] - lambda*(df\[F0; G0]);
xnew = upperLowerLimit(xynew(1), 0, 60*d2r);
ynew = upperLowerLimit(xynew(2), 0, 60*d2r);
[Fnew, Gnew] = func(xnew, ynew);
while i <= maxi && (abs(Fnew) >= abs(F0) || abs(Gnew) >= abs(G0))
    disp('缩小步长参数')
    lambda = lambda/2;
    xynew = [x0; y0] - lambda*(df\[F0; G0]);
    xnew = upperLowerLimit(xynew(1), 0, 60*d2r);
    ynew = upperLowerLimit(xynew(2), 0, 60*d2r);
    [Fnew, Gnew] = func(xnew, ynew);
    i = i + 1;
end

while iter <= maxiter && (abs(Fnew) > eps1 || abs(Gnew) > eps2)
    x0 = xnew;
    y0 = ynew;
    lambda = 1;
    [F0, G0] = func(x0, y0);
    [F1, G1] = func(x0+h, y0);
    [F2, G2] = func(x0, y0+h);
    dF0 = (F1 - F0)/h;
    dF1 = (F2 - F0)/h;
    dG0 = (G1 - G0)/h;
    dG1 = (G2 - G0)/h;
    df = [dF0, dF1; dG0, dG1];
    xynew = [x0; y0] - lambda*(df\[F0; G0]);
    xnew = upperLowerLimit(xynew(1), 0, 60*d2r);
    ynew = upperLowerLimit(xynew(2), 0, 60*d2r);
    [Fnew, Gnew] = func(xnew, ynew);
    i = 0;
    while i <= maxi && (abs(Fnew) >= abs(F0) || abs(Gnew) >= abs(G0))
        disp('缩小步长参数')
        lambda = lambda/2;
        xynew = [x0; y0] - lambda*(df\[F0; G0]);
        xnew = upperLowerLimit(xynew(1), 0, 60*d2r);
        ynew = upperLowerLimit(xynew(2), 0, 60*d2r);
        [Fnew, Gnew] = func(xnew, ynew);
        i = i + 1;
    end
    iter = iter + 1;
end
x = x0;
y = y0;
end